<?php $this->load->view("common/header") ?>
<body>

  <div id="page_wrapper">
<?php $this->load->view("common/speel") ?>

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td  valign="top"><?php $this->load->view("nav/main") ?></td>
      <td width="1265" valign="top"  id="mainContent">
        <table width="600" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>
          <div id="crum">
<?php echo $crum ?>
</div><br>

          <div>
          <span class="pageMsg"><?php echo $msg ?></span>
          </div>
          
          <form name="form1" method="post" action="<?php echo base_url() ."user/updateuser/" ?>">

              <table width="400" border="0" align="left" cellpadding="3" cellspacing="3">
                <tr>
                  <td colspan="2" class="tbl_header">Update user</td>
                </tr>
                <tr>
                  <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                  <td width="80" class="tbl_field_lable">First name</td>
                  <td width="300" class="tbl_field_input"><input name="firstname" type="text" id="firstname" size="25"value="<?php echo $user[0]['firstname'] ?>"></td>
                </tr>
                <tr>
                  <td class="tbl_field_lable">Last name</td>
                  <td class="tbl_field_input"><input name="lastname" type="text" id="lastname" size="25" value="<?php echo $user[0]['lastname'] ?>"></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td class="tbl_field_input">&nbsp;</td>
                </tr>
                <tr>
                  <td class="tbl_field_lable">User Type</td>
                  <td class="tbl_field_input"><select name="user_type" id="user_type">
                    <?php foreach($user_types as $ut) { ?>
                    <option 
                    <?php if($ut['lu_value'] == $user[0]['user_type'])
					{
						echo " selected ";	
					}
                    ?>
                    value="<?php echo $ut['lu_value']?>"><?php echo $ut['lu_lable']?></option>
                    <?php } ?>
                  </select>
                  
                   <select name="company" id="company" <?php if ($user[0]['user_type'] != 3) echo "style='display:none'" ?>>
                  <option value="0">Select a client</option>
                  <?php foreach ($clients as $client) { ?>
                  <option value="<?php echo ($client['id']) ?>" 
                  <?php if ($client['id'] == $user[0]['company_id']) echo " selected " ?>
                  ><?php echo ($client['company_name']) ?></option>
                  <?php } ?>
                </select
                  
                  ></td>
                </tr>
                <tr>
                  <td class="tbl_field_lable">Username</td>
                  <td class="tbl_field_input"><input name="username" type="text" id="username" size="25" value="<?php echo $user[0]['username'] ?>"></td>
                </tr>
                <tr>
                  <td class="tbl_field_lable">Password</td>
                  <td class="tbl_field_input"><input name="password" type="text" id="password" size="25"></td>
                </tr>
                <tr>
                  <td><input name="action" type="hidden" id="action" value="edituser">
                    <input name="uid" type="hidden" id="uid"  value="<?php echo $user[0]['id'] ?>"></td>
                  <td class="tbl_field_input"><input name="button" type="submit" class="tblBtn" id="button" value="Update User"></td>
                </tr>
              </table>
            </fieldset>
          </form></td>
        </tr>
      </table></td>
    </tr>
</table>

<?php $this->load->view("common/footer") ?>
</div>
</body>
</html>
